'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const sys_dict_data = app.model.define('sys_dict_data', {
    dictCode: {
      type: INTEGER(20),
      comment: "字典编码",
      unique:true,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
      field:"dict_code"
    },
    dictSort: {
      type: INTEGER(4),
      comment: "字典排序",
      defaultValue: 0,
      field:"dict_sort"
    },
    dictLabel: {
      type: STRING(100),
      comment: "字典标签",
      defaultValue: "",
      field:"dict_label"
    },
    dictValue: {
      type: STRING(100),
      comment: "字典键值",
      defaultValue: "",
      unique:true,
      field:"dict_value"
    },
    dictType: {
      type: STRING(100),
      comment: "字典类型",
      defaultValue: "",
      field:"dict_type"
    },
    cssClass: {
      type: STRING(200),
      comment: "样式属性（其他样式扩展）",
      defaultValue: "",
      field:"css_class"
    },
    listClass: {
      type: STRING(100),
      comment: "表格回显样式",
      defaultValue: "",
      field:"list_class"
    },
    isDefault: {
      type: STRING(1),
      comment: "是否默认（Y是 N否）",
      defaultValue: "N",
      field:"is_default"
    },
    status: {
      type: STRING(1),
      comment: "状态（0正常 1停用）",
      defaultValue: "0"
    },
    createBy: {
      type: STRING(64),
      comment: "创建者",
      defaultStatus: "",
      field:"create_by"
    },
    updateBy: {
      type: STRING(64),
      comment: "更新者",
      defaultValue: "",
      field:"update_by"
    },
    remark: {
      type: STRING(500),
      comment: "备注",
      defaultValue: ""
    },
    createTime:{
      type:DATE,
      field:"created_at"
    }
  }, {
    // paranoid: true,
    freezeTableName: true
  });

  return sys_dict_data;
};